import Vue from 'vue'

import App from './App.vue'

import '@/assets/css/bootstrap.css'
Vue.config.productionTip = false
import Vuex from 'vuex'


Vue.use(Vuex)
// 导入子模块
import cont from './store/cont'
import todo from './store/todo'

const store = new Vuex.Store({
  modules: {
    cont,
    todo
  },

  state: {
    count: 1919191,
    name: 'jojo',
    list: [{
      id: 100,
      name: "觉醒1",
      isDone: true
    }, {
      id: 100,
      name: "觉醒2",
      isDone: true
    }, {
      id: 100,
      name: "觉醒3",
      isDone: true
    }]
  },
  mutations: {
    add(state, payload) {
      state.count += payload.num
    }
  },
  actions: {
    subAsync(context) {
      setTimeout(() => {
        context.commit('add', {
          num: -5
        })
      }, 1000)
    }
  },
  getters: {
    isAll(state) {
      return state.list.every((item) => item.isDone)
    }
  }
})
new Vue({
  render: h => h(App),
  store
}).$mount('#app')